package com.example.permissionsystem1_1.businessFunction.dao.repository;

import com.example.permissionsystem1_1.businessFunction.dao.entity.po.RoleFunctionPo;
import com.example.permissionsystem1_1.businessFunction.dao.entity.po.UserFunctionRecordPo;
import com.example.permissionsystem1_1.common.businessFunction.BaseDao;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface UserFunctionRecordDao extends BaseDao<UserFunctionRecordPo> {

    /**
     * 批量新增多条记录
     * @param pos
     * @return
     */
    int insertBatch(@Param("pos")List<UserFunctionRecordPo> pos);
    /**
     * 根据给定的字段值删除符合条件的多条记录
     * @param po
     * @return
     */
    int deletes(@Param("po") UserFunctionRecordPo po);
    //************************\\

    /**
     * 根据用户id查询全部功能信息
     * @param userId
     * @return
     */
    List<UserFunctionRecordPo> selectAllFunctionsByUserId(@Param("userId")Long userId);

    /**
     * 根据给定的字段值删除符合条件的多条记录(不会删除userId=1的admin账号的功能权限)
     * @param po
     * @return
     */
    int deletesExcept(@Param("po") UserFunctionRecordPo po);

}
